#pragma once

#include "Frame.hpp"
#include "Text.hpp"




namespace Engine
{
	namespace Ui
	{
		class ENGINE_UI_API Window
			: public Frame
		{
		public:

			SHARED(Window);

		protected:

			/**
			 * Create a Window Widget.
			 */
			Window(Widget::weak_ptr parent);

			/**
			 * 
			 */
			virtual void post_create(Widget::ptr _this);

		public:

			MAKE_SHARED1(Window, Widget::weak_ptr);



			/**
			 * Get the configured minimum size of this window.
			 */
			virtual intsize2 configuredMinimumSize() const;



			/**
			 * Test if this window is currently resizing or not.
			 */
			bool resizing() const;



			/**
			 * Get the window title.
			 */
			QString title() const;

			/**
			 * Set the window title.
			 */
			void setTitle(const QString& title);

		protected:

			/**
			 * Get the type of this widget.
			 */
			virtual Widgets::Type type() const;

			/**
			 * This function is bound to the stateChanged() signal and repositions
			 * some elements, in case the frame size has been changed.
			 */
			void onStateChanged(Widget::weak_ptr that);

			/**
			 * Updates the widget, based on the current state.
			 * All widgets will be updated, no matter what their current state is.
			 */
			virtual void update(NestedState& state);

		private:

			Border::Type   m_resizingBorder;

			Text::ptr      m_title;
		};
		///////////////////////////////////////////////////////////////////////////////////////////
	}
	///////////////////////////////////////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////////////////////////////////////////
